//app.js  
var user = require('./services/user.js');

App({
  onLaunch: function () {
    let that = this
    //调用API从本地缓存中获取数据  
    //获取用户的登录信息
    user.appcheckLogin().then(res => {
      console.log('app login')
      this.globalData.userInfo = wx.getStorageSync('userInfo');
      this.globalData.token = wx.getStorageSync('token');
    }).catch(() => {

    });
    wx.getSystemInfo({
      success: function (res) {
        let model = res.model.substring(0, res.model.indexOf("X")) + "X";
        if (model == 'iPhone X') {
          that.globalData.isIpx = true  //判断是否为iPhone X 默认为值false，iPhone X 值为true
        }
      }
    })
  },
  globalData: { 
    userInfo: {
      userId:0,
      nickname: 'Hi,游客',
      phone: '',
      headurl: 'http://yalancodeimg.178mr.com/puser.png'
    },
    token: '',
    topuserid:0,
    sceneNum: '',
    isIpx: false
  }

}) 
